/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function call(url){
    
    if(window.XMLHttpRequest){
        mreq = new XMLHttpRequest();
    }else if(window.ActiveXObject){ 
        mreq = new ActiveXObject("Microsoft.XMLHTTP");
    }else{ 
        alert("Seu navegador não tem suporte a AJAX.");
    }

    mreq.onreadystatechange = orschange;
    mreq.open("GET","load/"+url,true);
    mreq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1") ;
    mreq.send(null);

}

function orschange() {
        if(mreq.readyState == 1){
            document.getElementById('title').innerHTML = 'Carregando...';		
            document.getElementById('text').innerHTML = '<img style="margin:auto;display:table" src="resources/imgs/loading.gif"/>';			
        }else if(mreq.readyState == 4){
            json = eval('('+mreq.responseText+')');
            document.getElementById('title').innerHTML = json.title;
            document.getElementById('text').innerHTML = json.page;
        }
    }
